Objects Reference

class flyEngine

Definition

class flyEngine
{
  public:

  int cur_step,cur_step_base;
  int cur_frame,cur_frame_base;
  int cur_time,cur_dt;

  flydllgroup dll;
  console con;

  bsp_object *player;
  bsp_object *cam;
  vector frustum[5];

  bsp_object *excludecollision,*stepobj;
  bsp_object *elemdraw[MAX_ELEMDRAW];
  bsp_object *elemlatedraw[MAX_ELEMDRAW];

  int nelemdraw;
  bsp_object *elemdraw[MAX_ELEMDRAW];
  int nelemlatedraw[MAX_LATEDRAW_LAYERS];
  bsp_object *elemlatedraw[MAX_LATEDRAW_LAYERS][MAX_ELEMDRAW];
  int *facedraw;
  int nfacedraw;
  int *facedrawtransp;
  int nfacedrawtransp;

  char flysdkpath[256];
  char flyfile[256];
  char flydatapath[256];
  char flyfilename[256];
  char bspfile[256];
  char status_msg[256];
  char console_command[256];
  unsigned status_msg_time;

  float bboxdiag,viewmaxdist,viewmindist,camangle,
       aspect,geomdetail,curveerr,lmpxsize,detailtile,
       cartoonwidth,shadowdepth;

  vector bbox1,bbox2,bboxC,filter,background,
         cartooncolor,shadowcolor;

  int nodedrawcount,nodeonly,pvsoff,fog,mpdelay,
    antialias,amblight,mapmode,multitexture,shadows,
    noinput,wireframe,mute,clearbk,moving,appid,mouse,
    crosshairpic,crosshairsize,intropic,introtime,
    detailpic,hwlights,stencil,cartoonpic,cartoonpicbsp;

  bsp_object *active_obj0,*last_active_obj;
  bsp_object *stock_obj0;
  mesh *model_obj0;
  sound *sound_obj0;
  bezier_curve *bezier_curve0;
  bezier_patch *bezier_patch0;
  bsp_object *shadow_obj;
  bsp_object *hitobj;
  mesh *hitmesh;
  int hitface;
  vector hitip;
  int status,fontspic,fonts_width[64],consolepic;
  vector *vert,*vertcolor,*vertnormal;
  face *faces;
  int nvert,nfaces;
  int *edges,nedges,*faceedges;
  bsp_node *bsp;

  light_map *lm[MAX_LIGHTMAP];
  light_map_pic *lmpic[MAX_LIGHTMAP];
  int nlm,lmbase,nlmpic;

  light_map *fm[MAX_LIGHTMAP];
  light_map_pic *fmpic[MAX_LIGHTMAP];
  int fmbase;

  picture *piclib[MAX_PICTURES];
  int npiclib;

  char *pvs;
  bsp_node *leaf[MAX_LEAF];
  int nleaf,pvssize,pvsrowsize;

  flyEngine();

  void draw_bsp(int mode=0);
  void draw_bsp_edges();
  int collision_bsp(bsp_node *n,vector& p1,vector& p2,int elemtype=0,float rad=0.0f);
  int collision_test(bsp_node *n,vector& p1,vector& p2,int elemtype=0,float rad=0.0f);
  void step(int dt);
  int step();
  void apply_bsp(bsp_node *n,vector& p,float rad,void *data,void (*func)(void *data,bsp_object *e));
  void apply_bsp(bsp_node *n,vector *p,int np,void *data,void (*func)(void *data,bsp_object *e));
  void send_bsp_message(bsp_node *n,vector& p,float rad,int msg,int param,void *data);
  int open_fly_file(char *file);
  void close_fly_file();
  int save_fly_file(char *file);
  int add_lightmap(int sx,int sy);
  void init_texture_cache();
  void close_texture_cache();
  void start_text_mode();
  void end_text_mode();
  void draw_text(int x,int y,char *text);
  void draw_text_center(int x,int y,char *text);
  virtual void set_status_msg(char *fmt, ...);
  int get_picture(char *file);
  bsp_object *get_stock_object(char *name);
  bsp_object *get_active_object(char *name);
  mesh *get_model_object(char *name);
  sound *get_sound_object(char *name);
  bezier_curve *get_bezier_curve(char *name);
  bezier_patch *get_bezier_patch(char *name);
  bsp_object *get_next_stock_object(bsp_object *o,int type=0);
  bsp_object *get_next_active_object(bsp_object *o,int type=0);
  int set_obj_param(char *objname,char *param,char *value);
  int get_obj_param(char *objname,char *param,char *value);
  int set_global_param(char *name, char *value);
  int get_global_param_desc(int i,param_desc *pd);
  void activate(bsp_object *d,int flag=1);
  void set_camera(bsp_object *d);
  bsp_node *get_random_point(vector& v,float mindist);
  bsp_node *find_node(bsp_node *n,vector& v,float mindist);
  int join_multiplayer(HWND hWnd,HINSTANCE hInst);
  void close_multiplayer();
  void check_multiplayer();

  virtual ~flyEngine()
  { close_fly_file(); };
};

Data Members

Member Type Description
cur_step int current step (each call to each object step function from each frame has an unique id)
cur_step_base int current step base (first step id for current frame) 
cur_frame int current frame
cur_frame_base int current frame base (multiple renders are possible in different viewports)
cur_time int current time in ms
cur_dt int current elapsed time from last frame in ms
dll flydllgroup all Fly3D plug-in dlls in current scene
con console console interface
player bsp_object * current player bsp_object pointer
cam bsp_object * current camera bsp_object pointer
frustum vector[] the view frustum (an array of 5 3D points)
excludecollision bsp_object * object pointer to be excluded from collision
stepobj bsp_object * pointer to object if inside some object step function
elemdraw bsp_object *[] array of elements to draw on current render
elemlatedraw bsp_object *[][] array of elements to draw later on current render
nelemdraw int number of elements in elemdraw array
nelemlatedraw int[] number of elements in each elemlatedraw array
facedraw int *  array of bsp faces to draw on current render
nfacedraw int  number of faces in facedraw array
facedrawtransp int * array of transparent bsp faces to draw on current render
nfacedrawtransp int number of faces in facedrawtransp array
flysdkpath char [] path for the flysdk dir
flyfile char [] path for the current .fly file
flydatapath char [] path for current .fly file data dir
flyfilename char [] filename for the current .fly file
bspfile char [] bsp filename fro the current .fly file
status_msg char [] the current status string
status_msg_time unsigned the time of the status string message
console_command char [] console command string, if <>"" command will be executed on next frame 
viewmaxdist float near plane distance
viewmindist float far plane distance
camangle float camera angle in degrees
aspect float render view aspect ratio
geomdetail float geometry detail (objects subdivide maintaining a vertex distance < geomdetail)
curveerr float curve subdivision maximum error (curves subdivide maintaining this maximum error)
lmpxsize float desired size in scene units for the light map pixels (for the flyLight precomputation)
bboxdiag float scene bounding box diagonal
bbox1 vector scene bounding box minimum point
bbox2 vector scene bounding box maximum point
bboxC vector scene bounding box center
filter vector current screen filter color (draw over the hole screen)
background vector background clear color
nodedrawcount int number of nodes drawn in last frame
status int if TRUE, status is draw
nodeonly int if TRUE, only the node containing the camera will be drawn
pvsoff int if TRUE, disables pvs culling
fog int if TRUE, enables distance vertex fog
mpdelay int delay between multiplayer positional updates in ms (50 for 20 updates/sec)
antialias int if TRUE enables hardware antialias
amblight int ambient light (0-255) for the flyLight precomputation
mapmode int map mode as bit array of 4 bits (0-15):
bit 1 - texture map
bit 2 - detail map
bit 3 - light map
bit 4 - fog map
ex. 
mapmode=1 means only texture map
mapmode=5 means texture map and light map
mapmode=15 means all maps
multitexture int if TRUE, enables multitexture support (up to 4 units)
shadows int if TRUE, enables dynamic shadows
shadowdepth float max distance for shadow
shadowcolor vector color for shadow polyons
noinput int if TRUE, all input is disabled (keyboard and mouse)
wireframe int if TRUE, renders to wireframe
mute int if TRUE, no sound is played
clearbk int if TRUE, clears the screen background prior to render
moving int if TRUE, some object is moving
cartoonpicbsp int 1D picture for bsp cartoon texture
cartoonpic int 1D picture for cartoon texture
cartooncolor vector color for cartoon edges
cartoonwidth float cartoon edges width
crosshairpic int picture for the cross-hair
crosshairsize int size for the cross-hair in pixels
appid int frontend application id
mouse int if TRUE, shows mouse cursor
hwlights int if TRUE, enable dynamic hardware lights for the dynamic objects
stencil int if TRUE, enables stencil buffer
datailpic int picture used for detail texture
detailtile float tile to multiply texture co-ordinates for the detail textures
active_obj0 bsp_object * active objects linked list
last_active_obj bsp_object * last object in active object linked list
stock_obj0 bsp_object * stock objects linked list
model_obj0 mesh * linked list of models
sound_obj0 sound * linked list of sounds
bezier_curve0 bezier_curve * linked list of Bezier curves
bezier_patch0 bezier_patch * linked list of Bezier paches
shadow_obj bsp_object * current object to cast shadows
hitobj bsp_object * current ray intersected object
hitmesh mesh * current ray intersected mesh
hitface int current ray intersected face
hitip vector current ray intersected point
fontspic int picture with the character fonts
fonts_width int [] array with each font character width (for fonts not fixed size)
consolepic int picture used on the console background
intropic int picture used for opening level introduction
introtime int time in ms for the introduction animation
nvert int number of vertices in bsp tree vert array
vert vector * array of vertices for the bsp tree faces
vertcolor vector * array of vertex colors for the bsp tree vertices
vertnormal vector * array of vertex normals
nfaces int number of faces in bsp tree
faces face * array of bsp tree faces
edges int * array of bsp face edges (4*nedges*sizeof(int))
nedges int number of edges in bsp edges array
faceedges int * array of edges for each bsp face (3*nfaces*sizeof(int))
bsp bsp_node * the bsp tree root node
lm light_map * individual light maps (each light mapped face points to one of these)
lmpic light_map_pic * light map picture groups array (each light map points to one of these)
nlm int number of light_map classes in lm array
lmbase int offset into texture array for the light map pictures
nlmpic int number of light_map_pic classes in lmpic array
fm light_map * individual fog maps
fmpic light_map_pic * fog map picture groups array (each fog_map points to one of these)
fmbase int offset into texture array for the fog maps
piclib picture * array of pictures used as texture maps
npiclib int number of pictures in piclib array
leaf bsp_node * bsp tree leaf array
nleaf int number of leaves in bsp tree
pvssize int size of the pvs array in bytes
pvsrowsize int size of each pvs row in bytes
pvs char * pvs bit array

Methods

collision_bsp, collision_test, step, apply_bsp, send_bsp_message, open_fly_file, close_fly_file, save_fly_file, add_light_map, init_texture_cache, close_texture_cache, start_text_mode, end_text_mode, draw_bsp, draw_bsp_edges, draw_text, draw_text_center, set_status_msg, get_picture, get_stock_object, get_active_object, get_model_object, get_sound_object, get_bezier_curve, get_bezier_patch, get_next_stock_object, get_next_active_object, set_obj_param, get_obj_param, set_global_param, get_global_param_desc, activate, set_camera, get_random_point, find_node, join_multiplayer, close_multiplayer, check_multiplayer

Remarks

This is the main interface with the engine. The global varible flyengine is initialized by the frontend and is from where all calls to the engine must be directed. 

See Also

vector, console, face, base_object, meshbezier_curve, bezier_patch, sound, bsp_node, bsp_object, light_map, light_map_pic, flydllgroup, picture